<template>
  <div class="distance">
    <MyHeader :title="title" />
    <MyGoods v-for="item in list" :key="item.id" :goods="item" />
    <MyFooter :list="list" />
  </div>
</template>

<script>
import MyHeader from "./components/MyHeader.vue";
import MyGoods from "./components/MyGoods.vue";
import MyFooter from "./components/MyFooter.vue";

export default {
  components: {
    MyHeader,
    MyGoods,
    MyFooter,
  },
  data() {
    return {
      title: "首页",
      list: [],
    };
  },
  async created() {
    let res = await this.$axios({
      url: "/api/cart",
    });
    this.list = res.data.list;
    console.log(this.list);
  },
};
</script>

<style lang="less" scoped>
.distance {
  padding: 45px 0 50px 0;
}
</style>